{% extends "base.html" %}
{% load i18n %}
{% load promgen %}

{% block title %}
Promgen / Project / {{ project.name }}
{% endblock %}

{% block content %}

<div class="page-header">
  <h1>
    Project: {{ project.name }}
    {% if project.owner %}
    <small class="pull-right">{% trans 'Contact' %}: {{project.owner.username}}</small>
    {% endif %}
  </h1>
</div>

{% breadcrumb project %}

{% if project.notifiers.count == 0 and project.service.notifiers.count == 0 %}
<div class="alert alert-warning" role="alert">
  <span class="glyphicon glyphicon-alert" aria-hidden="true"></span>
  <span class="sr-only">Warning:</span>
  {% trans 'No notifications configured for this project. Please configure some' %}
</div>
{% endif %}

{% include "promgen/project_detail_configuration.html" %}

<div class="panel panel-danger" v-cloak v-show="alertLabelsProject.has('{{project.name}}')">
  <div class="panel-heading">
    <a @click.prevent="toggleTarget('alerts-project-{{project.name|slugify}}')" class="btn btn-danger btn-sm" role="button">Alerts</a>
  </div>
  <table id="alerts-project-{{project.name|slugify}}" class="table table-bordered table-condensed">
    <tr v-for="(alert, index) in globalAlerts" v-if="alert.labels.project == '{{project.name}}'">
      {% include 'promgen/alert_row.html' %}
    </tr>
  </table>
</div>

<div id="silence-project-{{ project.name|slugify }}" class="panel panel-warning" v-cloak v-show="silenceLabelsProject.has('{{project.name}}')">
  <div class="panel-heading">
    <a @click.prevent="toggleTarget('silences-project-{{project.name|slugify}}')" class="btn btn-warning btn-sm" role="button">Silences</a>
  </div>
  <table id="silences-project-{{project.name|slugify}}" class="table table-bordered table-condensed">
    <tr v-for="(silence, index) in filterActiveSilences" v-if="silence.labels.project == '{{project.name}}'">
      {% include 'promgen/silence_row.html' %}
    </tr>
  </table>
</div>

<div class="row">
  <div class="col-md-6">
    {% include "promgen/project_detail_exporters.html" %}
    {% include "promgen/project_detail_hosts.html" %}
  </div>

  <div class="col-md-6">
    {% include "promgen/project_detail_urls.html" %}
    {% include "promgen/project_detail_notifiers.html" %}
  </div>
</div>

{% include "promgen/project_detail_rules.html" %}

{% endblock %}
